package com.user.dto;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.util.Assert;

public class GramtedAuthorityImpl implements GrantedAuthority {

    private static final long serialVersionUID = 500L;
    private String role;

    public void setRole(String role) {
        this.role = role;
    }

    public GramtedAuthorityImpl() {
    }

    public GramtedAuthorityImpl(String role) {
        Assert.hasText(role, "A granted authority textual representation is required");
        this.role = role;
    }


    @Override
    public String getAuthority() {
        return this.role;
    }

    @Override
    public int hashCode() {
        return this.role.hashCode();
    }

    @Override
    public String toString() {
        return this.role;
    }
}
